package com.atde._03_creational_design_patterns.fcatory.mydemo.demo01;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._03_creational_design_patterns.fcatory.mydemo.demo01
 * @Author: Del
 * @CreateTime: 2025-06-03  08:32
 * @Description: 简单工厂实现
 * @Version: 1.0
 */
public class OperationFactory {
    public static Operation createOperation(String operate){
        return switch (operate) {
            case "+" -> new Add();
            case "-" -> new Sub();
            case "*" -> new Mul();
            case "/" -> new Div();
            default -> null;
        };
    }
}
